home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / gui / precog2_1.lha / Precognition2_1 / include / GraphicObject.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-12  |  4.1 KB  |  167 lines

  1. /* ==========================================================================
  2. **
  3. **                               GraphicObject.h
  4. **
  5. ** PObject<GraphicObject
  6. **
  7. ** A GraphicObject is a virtual class, derrived from class PObject.
  8. ** Potentially anything that can be drawn on a RastPort is a
  9. ** graphic object.
  10. **
  11. **
  12. ** ©1991 WILLISoft
  13. **
  14. ** ==========================================================================
  15. */
  16.  
  17. #ifndef GRAPHICOBJECT_H
  18. #define GRAPHICOBJECT_H
  19.  
  20. #include "PObject.h"
  21. #include "Intuition_typedefs.h"
  22. #include "Precognition_utils.h"
  23.  
  24. typedef struct GraphicObject
  25.    {
  26.       const PClass   *isa;
  27.       char    *PObjectName;
  28.       void    *Next;        /* Points to next GraphicObject in chain. */
  29.    } GraphicObject;
  30.  
  31.  
  32.  
  33.  
  34. Point Location __PARMS((
  35.                   GraphicObject *self
  36.               ));
  37.    /*
  38.    ** Returns the LeftEdge, TopEdge of 'self'.
  39.    */
  40.  
  41.  
  42.  
  43. Point SetLocation __PARMS((
  44.                    GraphicObject *self,
  45.                    PIXELS         LeftEdge,
  46.                    PIXELS         TopEdge
  47.                   ));
  48.    /*
  49.    ** Sets the LeftEdge, TopEdge of 'self'.
  50.    ** Returns the LeftEdge, TopEdge.
  51.    */
  52.  
  53.  
  54. Point Size __PARMS((
  55.                   GraphicObject *self
  56.           ));
  57.    /*
  58.    ** Returns the Width, Height of 'self'.
  59.    */
  60.  
  61.  
  62. Point AskSize __PARMS((
  63.                GraphicObject *self,
  64.                PIXELS         Width,
  65.                PIXELS         Height
  66.              ));
  67.    /*
  68.    ** Given a (Width, Height), returns the nearest (Width, Height)
  69.    ** that 'self' modify itself to be.  Does NOT actually change
  70.    ** the dimensions of 'self'.  (Some graphic objects have
  71.    ** constraints on their size.)
  72.    */
  73.  
  74. #define MinSize(s) AskSize(s,0,0)
  75. #define MaxSize(s) AskSize(s,32767,32767)
  76.  
  77.  
  78. Point SetSize __PARMS((
  79.                GraphicObject *self,
  80.                PIXELS         Width,
  81.                PIXELS         Height
  82.               ));
  83.    /*
  84.    ** Sets 'self's size to be as near (Width, Height) as possible,
  85.    ** returns the actual (Width, Height).
  86.    */
  87.  
  88.  
  89. UWORD SizeFlags __PARMS((
  90.                   GraphicObject *self
  91.                ));
  92.    /*
  93.    ** Returns the flags which define the axis's on which this object may
  94.    ** be sized.
  95.    ** (This is useful for the editor environment)
  96.    */
  97.  
  98. #define OBJSIZE_X 0x0001   /* object can be resized along the X axis. */
  99. #define OBJSIZE_Y 0x0002   /* object can be resized along the Y axis. */
  100.  
  101.  
  102.  
  103. void Render __PARMS((
  104.              GraphicObject *self,
  105.              RastPort      *RPort
  106.            ));
  107.  
  108.    /*
  109.    ** Draw object to RastPort 'RPort'.  The object's Location is
  110.    ** used as the top-left corner of drawing.
  111.    */
  112.  
  113.  
  114. /* NOTE: Not all GraphicObjects support titles.   Those that don't
  115. ** ignore SetTitle(), and return NULL for Title().
  116. */
  117.  
  118. BOOL SetTitle __PARMS((
  119.                GraphicObject *self, char *title
  120.              ));
  121.    /*
  122.    ** returns FALSE if object does not support titles.
  123.    */
  124.  
  125. char *Title __PARMS((
  126.                GraphicObject *self
  127.             ));
  128.    /*
  129.    ** Returns a pointer to the title of an object, or NULL if none.
  130.    */
  131.  
  132.  
  133. /* addition of default font attributes to GraphicObjectClass -- EDB */
  134.  
  135. /* NOTE: Not all GraphicObjects support Default Fonts.  Those that don't
  136. ** ignore SetDefaultFont() and return FALSE and a pointer to Topaz80 for DefaultFont().
  137. ** Objects not subclassed off of GraphicObject should return NULL.
  138. */
  139. TextAttr *DefaultFont __PARMS(( GraphicObject *self ));
  140.  
  141. BOOL SetDefaultFont __PARMS(( GraphicObject *self, TextAttr *default_font ));
  142.    /*
  143.    ** returns FALSE if object does not support default fonts.
  144.    ** returns FALSE if object cannot open specified font.
  145.    */
  146.  
  147. AlignInfo *TextAlignment __PARMS((
  148.                GraphicObject *self
  149.                                 ));
  150.    /*
  151.    ** Returns a pointer to the AlignInfo of an object, or NULL if none.
  152.    */
  153.  
  154. BOOL SetTextAlignment __PARMS((
  155.                             GraphicObject *self,
  156.                             UBYTE          Flags,
  157.                             BYTE         Xpad,
  158.                             BYTE         Ypad
  159.                            ));
  160.    /*
  161.    ** returns FALSE if object cannot support the given arguments.
  162.    */
  163.  
  164. void GraphicObject_Init __PARMS(( GraphicObject *self ));
  165.  
  166. #endif
  167.